home *** CD-ROM | disk | FTP | other *** search
- /****************************************************************************
- *
- * $Source: /unixb/home/unixlib/source/unixlib37/src/unix/c/RCS/proc,v $
- * $Date: 1996/10/30 22:04:51 $
- * $Revision: 1.3 $
- * $State: Rel $
- * $Author: unixlib $
- *
- * $Log: proc,v $
- * Revision 1.3 1996/10/30 22:04:51 unixlib
- * Massive changes made by Nick Burret and Peter Burwood.
- *
- * Revision 1.2 1996/05/06 09:01:35 unixlib
- * Updates to sources made by Nick Burrett, Peter Burwood and Simon Callan.
- * Saved for 3.7a release.
- *
- * Revision 1.1 1996/04/19 21:35:27 simon
- * Initial revision
- *
- ***************************************************************************/
-
- static const char rcs_id[] = "$Id: proc,v 1.3 1996/10/30 22:04:51 unixlib Rel $";
-
- #include <errno.h>
- #include <unistd.h>
- #include <sys/types.h>
- #include <sys/unix.h>
-
- pid_t
- getpgrp (void)
- {
- return (__u->pgrp);
- }
-
- int
- setpgrp (pid_t pid, pid_t pgid)
- {
- if (__u->pid == pid)
- __u->pgrp = pgid;
- return (0);
- }
-
- int
- setpgid (pid_t pid, pid_t pgid)
- {
- return setpgrp (pid, pgid);
- }
-
- pid_t
- getpid (void)
- {
- return (__u->pid);
- }
-
- pid_t
- getppid (void)
- {
- return (__u->ppid);
- }
-
- uid_t
- getuid (void)
- {
- return (__u->uid);
- }
-
- int
- setuid (uid_t uid)
- {
- if (uid == __u->uid)
- return (0);
- if (uid == __u->euid)
- {
- __u->uid = uid;
- return (0);
- }
- return (-1);
- }
-
- uid_t
- geteuid (void)
- {
- return (__u->euid);
- }
-
- int
- seteuid (uid_t uid)
- {
- if (uid == __u->euid)
- return (0);
- if (uid == __u->uid)
- {
- __u->euid = uid;
- return (0);
- }
- return (-1);
- }
-
- gid_t
- getgid (void)
- {
- return (__u->gid);
- }
-
- /* Set the real and effective group ID of the process to gid. */
-
- int
- setgid (gid_t gid)
- {
- if (gid == __u->gid)
- return (0);
- if (gid == __u->egid)
- {
- __u->gid = gid;
- return (0);
- }
- return (-1);
- }
-
- gid_t
- getegid (void)
- {
- return (__u->egid);
- }
-
- int
- setegid (gid_t gid)
- {
- if (gid == __u->egid)
- return (0);
- if (gid == __u->gid)
- {
- __u->egid = gid;
- return (0);
- }
- return (-1);
- }
-